All Functions Used So Far, Week 5

pie

{graphics}

Creates a basic pie chart

range

{base}

Return range of values

geom_segment

{GGPLOT2}

Generates a line segment or curve

filter

{dplyr}

Filter out rows of a data frame according to logical vector

table

{base}

Obtain frequency table of a variable/cross-tabulation of two variables

rbeta

{stats}

Beta Random Number Generating Function

grid.arrange

{gridExtra}

Places graphical objects into a rectangular grid

order

{base}

Get indexes that will sort a vector

geom_density

{GGPLOT2}

Generates a density plot

ifelse

{base}

Return a or b depending on the value of test

factor

{base}

Create a factor

seq

{base}

Create a sequence

desc

{dplyr}

Arrange in descending order

theme_bw

{GGPLOT2}

A black and white ggplot theme

names

{base}

Retrieve names of a list/vector

expression

{base}

Used in plots to add symbols to axes

get_mode

{rstatix}

Compute the mode in a given vector.

summary

{base}

Obtain summary statistics or detailed regression output

as.data.frame

{base}

Functions to check if an object is a data frame, or coerce it if possible.

t.test

{stats}

Performs one and two sample t-tests on vectors of data.

matrix

{base}

Creates a matrix from the given set of values.

mutate

{dplyr}

Modify/create a column in a data frame

ordered

{dplyr}

Create an ordered factor

plot

{graphics}

Generic function from base R to produce a plot

which.max

{base}

return index of the largest value in a vector

select

{dplyr}

Select columns from a tibble/data frame

rbind

{base}

Combine R objects by rows

tabulate

{base}

Counts the number of times each integer occurs in an integer-only vector

bar

{base}

Used for annotations, such as “expression(paste(”-“,bar(y)))”

geom_ribbon

{GGPLOT2}

Generates an area plot

var

{stats}

Calculate variance

ggtitle

{GGPLOT2}

Generates a title for a ggplot graph

str

{utils}

Get the structure of an R object

dim

{base}

Get dimensions of a data frame

boxplot

{graphics}

Plot a simple box plot

round

{base}

Rounds numbers

summarise

{dplyr}

collapse the dataset to a summary statistic. Usually used with group_by()

levels

{base}

Get levels of a factor

data.frame

{base}

Create a data.frame from vectors

runif

{stats}

Draws ranndom numbers from the uniform distribution

ls

{base}

Return a vector of character strings giving the names of the objects in the specified environment

lprop

{questionr}

Display row percentages of a two-way frequency table

labs

{GGPLOT2}

Customise labels in GGPLOT2

read.spss

{foreign}

Read a .sav file (SPSS data)

aes

{GGPLOT2}

Construct aesthetic mapping of a ggplot graph

rnorm

{base}

Generate random numbers from a normal distribution

slice

{dplyr}

Subset rows using their positions

after_stat

{GGPLOT2}

Control aesthetic evaluation. On the module used for displying percent

head

{utils}

Show first 5 rows of a data frame

attach

{base}

Attach Set of R Objects to Search Path

nrow

{base}

Get number of rows of a data frame

theme

{GGPLOT2}

Set theme for GGPLOT2

cbind

{base}

Combine R objects by columns

dnorm

{stats}

Density distribution for the normal distribution

freq

{questionr}

Generate frequency tables

median

{stats}

Get median of a vector

group_by

{dplyr}

Group tibble/data.frame by a factor variable. All further tidyverse operations are performed group-wise

sample_n

{dplyr}

Sample a number of observations from a data frame

recode

{dplyr}

Recode a variable

arrow

{GGPLOT2}

Draw an arrow in a ggplot graph

with

{base}

evaluate expression in the context of a data frame

element_text

{GGPLOT2}

Customise text in GGPLOT2

ungroup

{dplyr}

Resolve grouping created with “group_by”

ylab

{GGPLOT2}

Label the y axis (ggplot)

ls.str

{utils}

Similarly to ls, with a print() method that calls str() on each object

cut

{base}

Convert Numeric to Factor

sd

{stats}

Get standard deviation of a vector

geom_point

{GGPLOT2}

Generates a scatter plot

mean

{base}

Get mean of a vector

ncol

{base}

Get number of columns of a data frame

sample

{base}

Takes a sample of the specified size

scale_y_continuous

{GGPLOT2}

Customise continuous y axis

prop.test

{stats}

Test of Equal or Given Proportions

arrange

{dplyr}

Sort values of data frame according to a variable/combination of varaibles

read_excel

{readxl}

Read an Excel file

rm

{base}

Remove objects

complete.cases

{stats}

Find Complete Cases

geom_bar

{GGPLOT2}

Generates a bar chart

geom_histogram

{GGPLOT2}

Generates a histogram

read.csv

{utils}

Read a csv file to data frame. Specify stringsAsFactors = FALSE to keep all string columns as characters

element_blank

{GGPLOT2}

This theme element draws nothing, and assigns no space

xlab

{GGPLOT2}

Label the x axis (ggplot)

min

{base}

Get minimum of a vector

setwd

{base}

Set Working Directory

install.packages

{base}

Install R package

c

{base}

Combine values/vectors into a vector

is.na

{base}

Check if a value is NA/elements of vector are NA

scale_x_continuous

{GGPLOT2}

Customise continuous x axis

ggplot

{GGPLOT2}

Create a ggplot graph

subset

{base}

Return subsets of vectors, matrices or data frames which meet conditions.

library

{base}

Load an R package

sum

{base}

Get sum of numeric values or a vector

max

{base}

Get maximum of a vector

set.seed

{base}

Initialise a pseudorandom number generator.

View

{base}

View a data frame

theme_classic

{GGPLOT2}

A minimalistic theme with no gridlines

class

{base}

Retrieve class of an R object

hist

{graphics}

Plot a simple histogram

unique

{base}

get unique elements

The end!